﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace  FileData.Currency.TypeConvert
{
    internal class Base64Convert
    {
        /// <summary>
        /// 转码为Base64
        /// </summary>
        /// <param name="Text"></param>
        /// <returns></returns>
        public string EnBase64(string Text)
        {
            byte[] ByteTemp = new ByteConvert().StrTobyte(Text);

            //转成 Base64 形式的 System.String
            Text = Convert.ToBase64String(ByteTemp);
            return Text;
        }

        /// <summary>
        /// 从Base64解码
        /// </summary>
        /// <param name="Text"></param>
        /// <returns></returns>
        public string DeBase64(string Base64Text)
        {
            byte[] ByteTemp = Convert.FromBase64String(Base64Text);

            //转成 Base64 形式的 System.String
            Base64Text = new ByteConvert().ByteToStr(ByteTemp);
            return Base64Text;
        }
    }
}